<template>
  <el-form :model="form" @keydown.enter.native="handleSubmit">
    <div class="iptClass">
      <el-input v-model="form.userName" class="ipt" placeholder="请输入手机号码">
        <span slot="prepend">
          <i class="el-icon-user-solid" />
        </span>
      </el-input>
    </div>
    <div class="iptClass">
      <el-input v-model="form.password" class="ipt" type="password" placeholder="请输入密码">
        <span slot="prepend">
          <i class="el-icon-lock" />
        </span>
      </el-input>
    </div>
    <div style="text-align: center;">
      <el-button style="width: 100%;" type="primary" @click="handleSubmit">登录</el-button>
    </div>

  </el-form>
</template>
<script>
  export default {
    name: 'Login',

    data() {
      return {
        form: {
          userName: '',
          password: ''
        }
      }
    },

    methods: {
      handleSubmit() {
        const user = {
          phone: this.form.userName,
          password: this.form.password
        }
        console.log(user)
        /* this.$api.goLogin(user).then((res)=>{
          console.log(res)
          if(res.data.level=='success'){
            this.$Modal.success({
              title: res.data.message,
              content: "点击确认进入首页"
            })
           const routerUrl = this.$router.push({name: '_home'})
            console.log(routerUrl)
          }else{
            this.$Modal.error({
              title: "登陆失败",
              content: "手机号码或者密码错误"
            })
            this.form.password=""
          }
        }) */
      }
    }
  }
</script>
<style scoped="scoped">
  .iptClass {
    margin-bottom: 20px;
    border: 1px solid #ffffff1a;
  }

  .ipt {
    height: 50px;
  }

  /deep/ .el-input-group__prepend {
    background-color: #0000003d;
    border: none;
  }

  /deep/.el-input-group--prepend .el-input__inner,
  .el-input-group__append {
    background-color: #0000003d;
    height: 50px;
    border: none;
    color: #ecf5ff;
  }

  /deep/.el-input-group__prepend {
    font-size: 18px;
  }

  /deep/.el-input__inner {
    padding: 0;
  }
</style>
